package org.linlinjava.litemall.admin.service;

import org.linlinjava.litemall.db.dao.TUser2Mapper;
import org.linlinjava.litemall.db.domain.TUser2;
import org.linlinjava.litemall.db.domain.TUser2Example;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class User2Service {


    public TUser2 findById(Integer user2Id) {
        return user2Mapper.selectByPrimaryKey(user2Id);
    }


    public TUser2 findByShopId(Integer sId) {
        return user2Mapper.selectOneByExample(TUser2Example.newAndCreateCriteria().andSIdEqualTo(sId).example());
    }

    public TUser2 findByCode(String code) {
        return user2Mapper.selectOneByExample(TUser2Example.newAndCreateCriteria().andCodeEqualTo(code).example());
    }


    public void updateUser(TUser2 user) {
        int i = user2Mapper.updateByPrimaryKeySelective(user);
        if (i > 0) {
            log.info("更新用户成功!");
        }
    }

    private static Logger log = LoggerFactory.getLogger(User2Service.class);

    @Autowired
    private TUser2Mapper user2Mapper;

}
